<template>
	<view class="consulta_con">
		<u-tabs :list="tabList" active-color="#7D2527" :is-scroll="false" :current="current" @change="change"></u-tabs>
		<view class="guid" v-for="(val,index) in 5" :key="index">
			<view class="top">
				<view class="head"></view>
				<view class="info">
					<view class="up">
						<view class="name">王某某</view>
						<view>09-01 14:32</view>
					</view>
					<view class="center">
						女 32岁 
					</view>
					<view class="down">18226608058</view>
				</view>
			</view>
			<view class="bottom">就诊3次，购药3次</view>
		</view>
	</view>
</template>

<script>
import { doctorRecordList,patientRecordList } from "@/api/consultation";
export default {
		data() {
			return {
				tabList: [{
					name: '患者'
				}, {
					name: '医生'
				}],
				current: 0,
				dataList:[]
			}
		},
		async onLoad() {
			await this.getRecordList()
			// await this.getPatientRecordList()
		},
		methods: {
			change(index) {
				this.current = index;
			},
			// 获取医生问诊记录
			async getRecordList() {
				const res = await doctorRecordList({
					"mobile": '18655358739',
				})
				if (res.code == 200) {
					this.dataList = res.data.records
				}
				if(res.code ==500){
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					return
				}
			},
			// 获取患者问诊记录
			async getPatientRecordList() {
				const res = await patientRecordList({
					"mobile": '18655358739',
				})
				if (res.code == 200) {
					this.dataList = res.data.records
				}
				if(res.code ==500){
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
					return
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.consulta_con{
		width:100%;
		height:100%;
		background: #F8F8F8;
		padding: 20rpx 29rpx;
		font-family: PingFang SC, PingFang SC;
		.guid{
			background: #FFFFFF;
			padding: 37rpx 46rpx;
			margin-bottom: 20rpx;
			border-radius: 16rpx;
			.top{
				padding-bottom: 40rpx;
				border-bottom: 1rpx solid #E4E4E4;
				display: flex;
				
				font-weight: 400;
				font-size: 30rpx;
				color: #666666;
				.head{
					width:120rpx;
					height:120rpx;
					border-radius: 50%;
					border:1px solid #888;
					margin-right: 30rpx;
				}
				.info{
					flex: 1;
					.up{
						display: flex;
						justify-content: space-between;
						margin-bottom: 8rpx;
						.name{
							font-size: 32rpx;
							color: #000000;
							font-weight: bold;
						}
					}
				}
			}
			.bottom{
				padding-top: 23rpx;
				font-weight: 400;
				font-size: 30rpx;
				color: #666666;
			}
		}
	}
</style>